<?php
/**
 * News_Controller
 * - Controller for module page News
 * @author ANHTAM
 * @since 1.1 - Sep 27, 2011
 * $Id: $
 */
// Require module for controller

class News_Controller extends Controller {
	/**
     * - Constructor
     */
    public function __construct() {
    	parent::__construct();
    }
    
    /**
     * actionIndex
     * - page index of controller
     */
    public function actionIndex() {
    	
    	// Process init
        $objView = new View ();
        $this->tpl_title = '.::MUA THẺ NHANH &rarr; TIN TỨC::.';
        $this->arrData = array();
        $this->nameNews = '';
        
        $this->dataGet = FunctionCommon::getGet(array('danhmucid'));
    	if ($this->dataGet['danhmucid'] == 1) {
    		$this->khuyenMai = true;
        	$this->nameNews = "Thông tin khuyến mãi";
        } else {
        	$this->tinTuc = true;
        	$this->nameNews = "Tin tức xã hội";
        }
        
        if ($this->dataGet['danhmucid'] != '') {
        	$ojbNews = new MNews();
        	$this->arrData = $ojbNews->getListFromNews($this->dataGet['danhmucid'], true, array(0,15));
        }
        
        // Process view
        $objView->assignobj($this);
        $objView->display();
    }
    
	/**
     * actionDetail
     * - page index of controller
     */
    public function actionDetail() {
    	
    	// Process init
        $objView = new View ();
        $this->tpl_title = '.::MUA THẺ NHANH &rarr; TIN TỨC::.';
        $this->nameNews = '';
        
        $this->dataGet = FunctionCommon::getGet(array('id', 'danhmucid'));
        if ($this->dataGet['danhmucid'] == 1) {
        	$this->khuyenMai = true;
        	$this->nameNews = "Thông tin khuyến mãi";
        } else {
        	$ojbNews = new MNews();
        	$this->nameNews = "Tin tức xã hội";
        }
        $ojbNews = new MNews();
        $this->arrData = $ojbNews->getByPrimaryKey($this->dataGet['id']);
        // Process view
        $objView->assignobj($this);
        $objView->display();
    }
}
?>

